<?php

class spInputButtonSubmit extends spInput
{
	public function __construct( $data=null )
	{
		parent::__construct( $data );
		parent::addAttr( "type", "submit" );
		
		$href = isset($data["href"])?$data["href"]:"";
		$confirm = isset($data["confirm"])?$data["confirm"]:"";
		$form_name = isset($data["form_name"])?$data["form_name"]:"";
		
		if ( $href!="" && $form_name!="" )
		{
			$confirm_inject = "return true;";
			if ( $confirm!="" )
			{
				$confirm_inject = "if (confirm('{$confirm}')) return true; else return false;";
			}

			$onclick = $form_name.".action='".$href."'; {$confirm_inject}";

			parent::addAttr( "onclick", $onclick );
		}		
	}
}

?>